package com.yt.system.dao;

import com.yt.system.domain.Account;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

@Mapper
@Repository
public interface AccountMapper {
    int deleteByPrimaryKey(Integer aid);

    int insert(Account record);

    int insertSelective(Account record);

    Account selectByPrimaryKey(Integer aid);

    int updateByPrimaryKeySelective(Account record);

    int updateByPrimaryKey(Account record);

    @Select("select * from account where aacount = #{aacount}")
    Account selectByAacount(String aacount);

    int updateAintegralByUid(@Param("uid") Integer uid, @Param("status") Integer status);

    List<Account> getAllAccount();

    @Update("update account set apwd = #{apwd} where aid = #{aid}")
    int resetPassword(String apwd, Integer aid);  //重置密码

    @Update("update account set alogintime = #{alogintime} where aacount = #{aacount}")
    int updateAlogintime(Date alogintime, String aacount);  //更新用户登录时间

    @Update("update account set alogouttime = #{alogouttime} where aacount = #{aacount}")
    int updateAlogouttime(Date alogouttime, String aacount);  //更新用户退出登录时间
    @Select("select * from account where aacount like  CONCAT('%',#{str},'%')")
    List<Account> searchLikeAccount(String str);

}